#include "dog.h"

static dog_klass_info local_dog_klass = {dog_init};
dog_klass_info* dog_klass = &local_dog_klass;

static dog* dog_ctor(dog* self)
{
	((voidf)(klass_of(self)->super->ctor))(self);
	self->age = 0;
	return self;
}

static char* local_dog_move(animal* self)
{
	(void)self;
	return "run";
}

void dog_init(void)
{
	if(KLASS(dog_klass)->init)
	{
		animal_init();
		memcpy(dog_klass, animal_klass, sizeof(animal_klass_info));
		KLASS(dog_klass)->super = animal_klass;
		KLASS(dog_klass)->name = "dog_klass";
		KLASS(dog_klass)->size = sizeof(dog);
		KLASS(dog_klass)->ctor = dog_ctor;
		ANIMAL_KLASS(dog_klass)->move = local_dog_move;
	}
}

int dog_get_age(dog* self)
{
	return self->age;
}

void dog_set_age(dog* self, int age)
{
	self->age = age;
}